import request from '@/utils/request'

// 查询学校列表
export function listSchool(query) {
    return request({
        url: '/sm/sm/list',
        method: 'get',
        params: query
    })
}

// 查询学校详细
export function getSchool(schoolId) {
    return request({
        url: '/sm/sm/' + schoolId,
        method: 'get'
    })
}

// 新增学校
export function addSchool(data) {
    return request({
        url: '/sm/sm',
        method: 'post',
        data: data,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

// 修改学校
export function updateSchool(data) {
    return request({
        url: '/sm/sm',
        method: 'put',
        data: data,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

// 学校数据权限
export function dataScope(data) {
    return request({
        url: '/sm/sm/dataScope',
        method: 'put',
        data: data
    })
}

// 学校状态修改
export function changeSchoolStatus(schoolId, status) {
    const data = {
        schoolId,
        status
    }
    return request({
        url: '/sm/sm/changeStatus',
        method: 'put',
        data: data
    })
}

// 删除学校
export function delSchool(schoolId) {
    return request({
        url: '/sm/sm/' + schoolId,
        method: 'delete'
    })
}


// 根据学校ID查询部门树结构
export function deptTreeSelect(schoolId) {
    return request({
        url: '/sm/sm/deptTree/' + schoolId,
        method: 'get'
    })
}
